<?php
session_start();
$page = "login";
// Check for logged in status
include('config.php');

if(@$_SESSION['userdata']['logged_in'] == "TRUE"){
	header("Location:member-home.php");
}
if(isset($_POST['login'])){
$getdata = Current_User::login($_POST['email'],$_POST['pass']);
	//var_dump($getdata);
	if($getdata['logged_in'] == 'TRUE')
	{
		header('Location:member-home.php');
		echo $_SESSION['userdata']['email_id'];
	}
	else
	{
		$err =  "Login information is not correct";
		//return FALSE;
	}
}

if(isset($_GET['err'])){
	
	if($_GET['err'] == 'login'){
		$err =  "Please Login to access this page";
	}
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html>
<head>
<meta name="viewport" content="width=320, user-scalable=no" />
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<title>Login</title>
<link href="html/main.css" rel="stylesheet" type="text/css" />
</head>

<body>
<div id="body-wrapper">
<div id="header"><?php include('menu.php');?></div>
<div id="Content">
	<form method="post"  action="#" >
<fieldset title="Plan a Trip"><legend>Login</legend> 
<div class="error-msg"><?php  if(isset($err)) echo $err."<br>" ;?></div>
<label	for="start-address"> Email Id</label>
<div class="row"><input type="text" size="30" name="email"></input></div>
<label>Password</label>
<div class="row"><input type="password" size="30" name="pass"></input></div>
</fieldset>
<div class="row"><input type="submit" value="Login" name="login"></input></div>
</form>
<div class="clear"></div>
<a href="register.php">Not a member? Register Now!</a>
<div class="clear"></div>
</div>
</div>

</body>
</html>
